<div id="calculating">
  <h1><%= t '.title' %></h1>
</div>

<% unless current_user.email %>
<div id="give-email">
  <p><%= t('.delayed_calculation') %></p>
    <% form_for(current_user) do |f| %>
    <ol>
      <li>
        <%= f.label(:email, t('generic.email'), :title => t('.tooltip.email')) %>
        <%= f.text_field(:email, :title => t('.tooltip.email')) %>
    </li>
    <li>
      <%= submit_tag(t('generic.save'), :title => t('.tooltip.save')) %>
    </li>
  </ol>
  <% end %>
</div>
<% end %>

<% content_for :javascript do %>
$(document).ready(function() {
  $("#give-email").hide().delay(15000).fadeIn('slow');
  $("#give-email form").submitWithAjax();

  timer = window.setInterval(function() {
    $.get(document.location.pathname, function(data) {
      if (data) {
        $("#content").html(data);
        window.clearInterval(timer);
      }
    });
  }, 5000);
});
<% end %>
